home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Mail
/
pine3.92
/
pine
/
osdep
/
canonicl
< prev
next >
Wrap
Text File
|
1993-07-15
|
772b
|
27 lines
/*----------------------------------------------------------------------
Return canonical form of host name ala c-client (UNIX version).
Args: host -- The host name
Result: Canonical form, or input argument (worst case)
----*/
char *
canonical_name(host)
char *host;
{
struct hostent *hent;
char hostname[MAILTMPLEN];
char tmp[MAILTMPLEN];
extern char *lcase();
/* domain literal is easy */
if (host[0] == '[' && host[(strlen (host))-1] == ']')
return host;
strcpy (hostname,host); /* UNIX requires lowercase */
/* lookup name, return canonical form */
return (hent = gethostbyname (lcase (strcpy (tmp,host)))) ?
hent->h_name : host;
}